package com.tree.thrive.business.event;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Component;

/**
 * @Auther: cheng.tang
 * @Date: 2024/10/23
 * @Description: top-tree
 */
@Component
public class CustomEventPublisher {
    private final ApplicationEventPublisher publisher;

    @Autowired
    public CustomEventPublisher(ApplicationEventPublisher publisher) {
        this.publisher = publisher;
    }

    public void publish(String message) {
        CustomEvent event = new CustomEvent(this, message);
        publisher.publishEvent(event);
    }

}
